/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package x10.interfaces.cm15a.transmit;

import java.util.logging.Logger;

import x10.event.X10Event;
import x10.event.X10InterfaceRequest;
import x10.queues.X10TransmitQueue;
import x10.utilities.ChunkOfBytes;

/**
 *
 * @author Denny
 */
public class IFRequestFactory extends X10DeviceTransmitter {
    Logger logger = Logger.getLogger(this.getClass().getName());

    X10InterfaceRequest request;

    public IFRequestFactory(X10TransmitQueue transmitQueue){
        super(transmitQueue);
    }

    public void transmit(X10Event device){
        try{
            request = (X10InterfaceRequest)device;
        } catch (Exception e){
            logger.warning("Unable to cast X10Device to X10InterfaceRequest");
        }

        ChunkOfBytes bytes = request.getBytes();
        transmitQueue.put(bytes);
    }
}
